<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:userInterfaceLibrary="clr-namespace:MyCompany.UserInterfaceLibrary">
    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="../ValueConverters.xaml" />
        <ResourceDictionary Source="../NamedStyles/StandardColors.xaml" />
        <!--<ResourceDictionary Source="../NamedStyles/BorderStyles.xaml" />
        <ResourceDictionary Source="../NamedSuserInterfaceLibrary:NarrowButtontyles/TextBlockStyles.xaml" />-->
    </ResourceDictionary.MergedDictionaries>

    <Style TargetType="userInterfaceLibrary:NarrowToggleButton">
        <!--<Setter Property="BorderBrush" Value="Orange" />-->
        <!--<Setter Property="Background" Value="Red" />-->
        <Setter Property="Padding" Value="4,2,4,5" />
        <!--<Setter Property="Padding" Value="3,3,3,5" />-->
        <Setter Property="HorizontalContentAlignment" Value="Left" />
        <Setter Property="VerticalContentAlignment" Value="Top" />
        <!--<Setter Property="CheckedBackgroundColor" Value="White" />-->
        <!--  Remove the ugly dotted line around the selection.  -->
        <Setter Property="FocusVisualStyle" Value="{x:Null}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="userInterfaceLibrary:NarrowToggleButton">
                    <Grid>
                        <Grid.Background>
                            <SolidColorBrush x:Name="solidColorBrushGridBackground" Color="#00FFFFFF" />
                        </Grid.Background>
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup Name="CommonStates">
                                <VisualState Name="Normal" />
                                <VisualState Name="MouseOver">
                                    <Storyboard>
                                        <!--<DoubleAnimation Duration="0:0:1.0" Storyboard.TargetName="solidColorBrushGridBackground.Color" Storyboard.TargetProperty="ScA" To="0.5" />-->
                                        <!--  Storyboard.TargetProperty="Color" To="#10FFFFFF"  -->
                                    </Storyboard>
                                </VisualState>
                                <VisualState Name="Pressed">
                                    <Storyboard />
                                </VisualState>
                                <VisualState Name="Disabled">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0:0:1"
                                                         Storyboard.TargetName="contentPresenter"
                                                         Storyboard.TargetProperty="Opacity"
                                                         To="0.3" />
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="CheckStates">
                                <VisualState x:Name="Checked">
                                    <Storyboard>
                                        <ColorAnimation Duration="0:0:0.0"
                                                        Storyboard.TargetName="solidColorBrushGridBackground"
                                                        Storyboard.TargetProperty="Color"
                                                        To="{StaticResource ColorDarkGrey}" />
                                        <!--  #10FFFFFF To="{TemplateBinding CheckedBackgroundColor}"  -->
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Unchecked" />
                            </VisualStateGroup>
                            <VisualStateGroup Name="FocusStates">
                                <VisualStateGroup.Transitions>
                                    <!--  Apply only in one direction:  -->
                                    <VisualTransition GeneratedDuration="0" To="Unfocused" />
                                </VisualStateGroup.Transitions>
                                <VisualState Name="Unfocused" />
                                <VisualState Name="Focused">
                                    <Storyboard>
                                        <!--  #FF73756E is ColorIDarkGrey      #FF73756E  -->
                                        <ColorAnimation Duration="0:0:.2"
                                                        Storyboard.TargetName="animatedBorderBrush"
                                                        Storyboard.TargetProperty="Color"
                                                        To="Black" />
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>

                        <Rectangle StrokeDashArray="1,2"
                                   StrokeDashCap="Round"
                                   StrokeThickness="1">
                            <Rectangle.Stroke>
                                <SolidColorBrush x:Name="animatedBorderBrush" Color="Transparent" />
                            </Rectangle.Stroke>
                        </Rectangle>

                        <!--  NOTE: This can be shown/hidden based on mouse over and other criteria. See the .cs file for the logic.  -->
                        <Border x:Name="border"
                                Background="#20FFFFFF"
                                BorderBrush="{TemplateBinding BorderBrush}" />
                        <!--  BorderThickness="1" CornerRadius="2" Padding="2" Background="{TemplateBinding Background}"  -->

                        <ContentPresenter x:Name="contentPresenter"
                                          Margin="{TemplateBinding Padding}"
                                          HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                          VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
                        <!--  was Opacity 0.8  -->
                        <Path x:Name="path"
                              HorizontalAlignment="Center"
                              VerticalAlignment="Bottom"
                              Data="M 0,0 l 7,0 l -3.5,4 l -3.5,-4 Z"
                              Fill="DarkGray"
                              Stroke="LightGray"
                              StrokeThickness="1"
                              Visibility="{TemplateBinding DropDownContextMenu,
                                                           Converter={StaticResource VisibilityConverter},
                                                           ConverterParameter=NullToCollapsedAndNotNullToVisible}" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="Cursor" Value="Hand" />
    </Style>
</ResourceDictionary>